﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using ChinaUnicom.ViewModels;
using Microsoft.Phone.Tasks;

namespace ChinaUnicom.Views
{
    public partial class SettingsPage : PhoneApplicationPage
    {
        public SettingsPage()
        {
            InitializeComponent();

            Loaded += OnPageLoaded;
        }

        void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            if (!Authentication.Current.Authorized)
            {
                ContentContainer.SelectedIndex = 1;
            }

            DataContext = new SettingsContext();
        }

        private void OnBackClick(object sender, EventArgs e)
        {
            NavigationService.GoBack();
        }

        private void OnReviewClick(object sender, EventArgs e)
        {
            MarketplaceReviewTask review = new MarketplaceReviewTask();
            review.Show();
        }

        private void OnShareClick(object sender, EventArgs e)
        {
            MarketplaceDetailTask detail = new MarketplaceDetailTask();
            detail.Show();
        }
    }
}